//
//  UserToAccessTableViewCell.m
//  YIJU2.0HD
//
//  Created by 张金国 on 16/5/24.
//  Copyright © 2016年 Mr.X. All rights reserved.
//

#import "UserToAccessTableViewCell.h"
#import "Masonry.h"

@interface UserToAccessTableViewCell ()

@property (nonatomic ,strong)UIView  *containerView;

@property (nonatomic ,strong)UILabel  *timeLabel;

@property (nonatomic ,strong)UILabel  *booker;

@end

@implementation UserToAccessTableViewCell

#pragma mark - init
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setupConstraint];
    }
    return self;
}
#pragma mark - private
- (void)setupConstraint{
    
    [self.containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.contentView);
    }];
    
    [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.contentView.mas_left).offset(10);
        make.top.equalTo(self.containerView.mas_top).offset(10);
        make.bottom.equalTo(self.containerView.mas_bottom).offset(-10);
        make.width.greaterThanOrEqualTo(120);
        
    }];
    
    
    [self.booker mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.contentView.mas_right).offset(-10);
        make.top.equalTo(self.containerView.mas_top).offset(10);
        make.bottom.equalTo(self.containerView.mas_bottom).offset(-10);
        make.width.greaterThanOrEqualTo(120);
        
    }];
}


- (UIView *)containerView {
    if (!_containerView) {
        _containerView = [[UIView alloc]init];
        [self.contentView addSubview:_containerView];
    }
    return _containerView;
}

- (UILabel *)timeLabel {
    if (!_timeLabel) {
        _timeLabel = [[UILabel alloc]init];
        [self.containerView addSubview:_timeLabel];
    }
    return _timeLabel;

}

- (UILabel *)booker {
    if (!_booker) {
        _booker = [[UILabel alloc]init];
        _booker.textAlignment = NSTextAlignmentLeft;
        [self.containerView addSubview:_booker];
    }
    return _booker;
}

- (void)setModel:(UserToAccessCellModel *)model {

    _model = model;
    self.timeLabel.text = [NSString stringWithFormat:@"访问时间：%lld",model.time];
    self.booker.text = [NSString stringWithFormat:@"登记人：%@",model.booker];

}


@end
